package com.wd.elec.controller.bussiness;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.wd.common.core.controller.BaseController;
import com.wd.common.core.domain.HttpResponse;
import com.wd.elec.domain.PowerUnitData;
import com.wd.elec.domain.dto.DataQueryDto;
import com.wd.elec.domain.vo.PowerUnitStack;
import com.wd.elec.service.IPowerUnitDataService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @className: PowerUnitController
 * @description: TODO 类描述
 * @author: liumingkun
 * @date: 2024/8/19
 **/
@RestController
@RequestMapping("/power_unit")
public class PowerUnitController extends BaseController {

    @Resource
    IPowerUnitDataService powerUnitDataService;

//    /**
//     * 获取【请填写功能名称】详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('visitor:area:query')")
//    @GetMapping(value = "/data/stack")
//    public HttpResponse listDataStack() {
//
//        String jsonStr=" [{\"dt\":\"2025-01-01 00:00:00\",\"value\":{\"coal\":0.4607881392403595,\"gas\":0.16774430055469597,\"biomass\":0.11720065965747076,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":177.94946528077432,\"storage\":0}},{\"dt\":\"2025-01-01 01:00:00\",\"value\":{\"coal\":0.46055070298738643,\"gas\":0.16706072883810394,\"biomass\":0.11625800672099743,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":168.79604263135144,\"storage\":0}},{\"dt\":\"2025-01-01 02:00:00\",\"value\":{\"coal\":0.46029672485686085,\"gas\":0.16668225426779823,\"biomass\":0.11576545971754826,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":159.3183270806765,\"storage\":0}},{\"dt\":\"2025-01-01 03:00:00\",\"value\":{\"coal\":0.4601362589574646,\"gas\":0.1664634335638863,\"biomass\":0.11546330293780563,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":149.44753906518517,\"storage\":0}},{\"dt\":\"2025-01-01 04:00:00\",\"value\":{\"coal\":0.45991865350301897,\"gas\":0.16626140330462935,\"biomass\":0.1151749524004257,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":139.08974160346006,\"storage\":0}},{\"dt\":\"2025-01-01 05:00:00\",\"value\":{\"coal\":0.4596650623430896,\"gas\":0.1660503142118086,\"biomass\":0.11487809873162759,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":128.10206646211364,\"storage\":0}},{\"dt\":\"2025-01-01 06:00:00\",\"value\":{\"coal\":0.4589768217494784,\"gas\":0.16557754848963888,\"biomass\":0.1141811068641758,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":116.28648202317031,\"storage\":0}},{\"dt\":\"2025-01-01 07:00:00\",\"value\":{\"coal\":0.45852174864677725,\"gas\":0.16510198451398017,\"biomass\":0.11364133045381533,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":103.2714479638567,\"storage\":0}},{\"dt\":\"2025-01-01 08:00:00\",\"value\":{\"coal\":0.45818321073973195,\"gas\":0.16483611708062945,\"biomass\":0.11324377148677485,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":88.66655960169098,\"storage\":0}},{\"dt\":\"2025-01-01 09:00:00\",\"value\":{\"coal\":0.45820490895176336,\"gas\":0.16474024908325569,\"biomass\":0.1131984491926154,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":73.53412246935972,\"storage\":0}},{\"dt\":\"2025-01-01 10:00:00\",\"value\":{\"coal\":0.45847842470915945,\"gas\":0.1649255264836785,\"biomass\":0.1134541859688133,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":66.87704092911127,\"storage\":0}},{\"dt\":\"2025-01-01 11:00:00\",\"value\":{\"coal\":0.4589643360746205,\"gas\":0.165285666376292,\"biomass\":0.11391936779809769,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":77.29276146539114,\"storage\":0}},{\"dt\":\"2025-01-01 12:00:00\",\"value\":{\"coal\":0.4593333391613782,\"gas\":0.16564379221695377,\"biomass\":0.11430726381476031,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":110.10933098506283,\"storage\":0}},{\"dt\":\"2025-01-01 13:00:00\",\"value\":{\"coal\":0.4593007087958422,\"gas\":0.16557080978662733,\"biomass\":0.11425762492843117,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":164.32281173538942,\"storage\":0}},{\"dt\":\"2025-01-01 14:00:00\",\"value\":{\"coal\":0.4594455470641632,\"gas\":0.16556096476042284,\"biomass\":0.11423618380713761,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":226.9248429844367,\"storage\":0}},{\"dt\":\"2025-01-01 15:00:00\",\"value\":{\"coal\":0.46059263970675635,\"gas\":0.16571296184032527,\"biomass\":0.11412071564475566,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":284.38862399341434,\"storage\":0}},{\"dt\":\"2025-01-01 16:00:00\",\"value\":{\"coal\":0.45862995477724183,\"gas\":0.1647331837542344,\"biomass\":0.11294037905036278,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":315.21395528713646,\"storage\":0}},{\"dt\":\"2025-01-01 17:00:00\",\"value\":{\"coal\":0.45597743148544867,\"gas\":0.16285277722737962,\"biomass\":0.11063701304870222,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":310.7559275135563,\"storage\":0}},{\"dt\":\"2025-01-01 18:00:00\",\"value\":{\"coal\":0.4531200462007679,\"gas\":0.16060522803302515,\"biomass\":0.10820131711947596,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":294.14793630504045,\"storage\":0}},{\"dt\":\"2025-01-01 19:00:00\",\"value\":{\"coal\":0.456976520344975,\"gas\":0.16334840630823524,\"biomass\":0.11120760143278355,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":272.4366604509179,\"storage\":0}},{\"dt\":\"2025-01-01 20:00:00\",\"value\":{\"coal\":0.45798956167779514,\"gas\":0.16392007028841246,\"biomass\":0.11194464998131488,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":250.65566873649408,\"storage\":0}},{\"dt\":\"2025-01-01 21:00:00\",\"value\":{\"coal\":0.4599074597563031,\"gas\":0.1650248472462731,\"biomass\":0.11339324889179779,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":229.40205973240762,\"storage\":0}},{\"dt\":\"2025-01-01 22:00:00\",\"value\":{\"coal\":0.4613589129046265,\"gas\":0.1659233612975514,\"biomass\":0.11451539494601566,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":208.35438635208362,\"storage\":0}},{\"dt\":\"2025-01-01 23:00:00\",\"value\":{\"coal\":0.46420860297848704,\"gas\":0.16772229959391005,\"biomass\":0.11643037591575615,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":186.90901224770155,\"storage\":0}}]";
//        JSONArray jsonArray=JSONArray.parseArray(jsonStr);
//        return successData(jsonArray);
//    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('visitor:area:query')")
    @GetMapping(value = "/data/stack")
    public HttpResponse listDataStack(DataQueryDto queryDto) {

        List<PowerUnitStack> powerUnitStacks = powerUnitDataService.listPowerUnitStack(queryDto);
        return successData(powerUnitStacks);
    }

    public static void main(String[] args) {
        String jsonStr=" [{\"dt\":\"2025-01-01 00:00:00\",\"value\":{\"coal\":0.4607881392403595,\"gas\":0.16774430055469597,\"biomass\":0.11720065965747076,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":177.94946528077432,\"storage\":0}},{\"dt\":\"2025-01-01 01:00:00\",\"value\":{\"coal\":0.46055070298738643,\"gas\":0.16706072883810394,\"biomass\":0.11625800672099743,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":168.79604263135144,\"storage\":0}},{\"dt\":\"2025-01-01 02:00:00\",\"value\":{\"coal\":0.46029672485686085,\"gas\":0.16668225426779823,\"biomass\":0.11576545971754826,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":159.3183270806765,\"storage\":0}},{\"dt\":\"2025-01-01 03:00:00\",\"value\":{\"coal\":0.4601362589574646,\"gas\":0.1664634335638863,\"biomass\":0.11546330293780563,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":149.44753906518517,\"storage\":0}},{\"dt\":\"2025-01-01 04:00:00\",\"value\":{\"coal\":0.45991865350301897,\"gas\":0.16626140330462935,\"biomass\":0.1151749524004257,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":139.08974160346006,\"storage\":0}},{\"dt\":\"2025-01-01 05:00:00\",\"value\":{\"coal\":0.4596650623430896,\"gas\":0.1660503142118086,\"biomass\":0.11487809873162759,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":128.10206646211364,\"storage\":0}},{\"dt\":\"2025-01-01 06:00:00\",\"value\":{\"coal\":0.4589768217494784,\"gas\":0.16557754848963888,\"biomass\":0.1141811068641758,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":116.28648202317031,\"storage\":0}},{\"dt\":\"2025-01-01 07:00:00\",\"value\":{\"coal\":0.45852174864677725,\"gas\":0.16510198451398017,\"biomass\":0.11364133045381533,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":103.2714479638567,\"storage\":0}},{\"dt\":\"2025-01-01 08:00:00\",\"value\":{\"coal\":0.45818321073973195,\"gas\":0.16483611708062945,\"biomass\":0.11324377148677485,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":88.66655960169098,\"storage\":0}},{\"dt\":\"2025-01-01 09:00:00\",\"value\":{\"coal\":0.45820490895176336,\"gas\":0.16474024908325569,\"biomass\":0.1131984491926154,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":73.53412246935972,\"storage\":0}},{\"dt\":\"2025-01-01 10:00:00\",\"value\":{\"coal\":0.45847842470915945,\"gas\":0.1649255264836785,\"biomass\":0.1134541859688133,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":66.87704092911127,\"storage\":0}},{\"dt\":\"2025-01-01 11:00:00\",\"value\":{\"coal\":0.4589643360746205,\"gas\":0.165285666376292,\"biomass\":0.11391936779809769,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":77.29276146539114,\"storage\":0}},{\"dt\":\"2025-01-01 12:00:00\",\"value\":{\"coal\":0.4593333391613782,\"gas\":0.16564379221695377,\"biomass\":0.11430726381476031,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":110.10933098506283,\"storage\":0}},{\"dt\":\"2025-01-01 13:00:00\",\"value\":{\"coal\":0.4593007087958422,\"gas\":0.16557080978662733,\"biomass\":0.11425762492843117,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":164.32281173538942,\"storage\":0}},{\"dt\":\"2025-01-01 14:00:00\",\"value\":{\"coal\":0.4594455470641632,\"gas\":0.16556096476042284,\"biomass\":0.11423618380713761,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":226.9248429844367,\"storage\":0}},{\"dt\":\"2025-01-01 15:00:00\",\"value\":{\"coal\":0.46059263970675635,\"gas\":0.16571296184032527,\"biomass\":0.11412071564475566,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":284.38862399341434,\"storage\":0}},{\"dt\":\"2025-01-01 16:00:00\",\"value\":{\"coal\":0.45862995477724183,\"gas\":0.1647331837542344,\"biomass\":0.11294037905036278,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":315.21395528713646,\"storage\":0}},{\"dt\":\"2025-01-01 17:00:00\",\"value\":{\"coal\":0.45597743148544867,\"gas\":0.16285277722737962,\"biomass\":0.11063701304870222,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":310.7559275135563,\"storage\":0}},{\"dt\":\"2025-01-01 18:00:00\",\"value\":{\"coal\":0.4531200462007679,\"gas\":0.16060522803302515,\"biomass\":0.10820131711947596,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":294.14793630504045,\"storage\":0}},{\"dt\":\"2025-01-01 19:00:00\",\"value\":{\"coal\":0.456976520344975,\"gas\":0.16334840630823524,\"biomass\":0.11120760143278355,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":272.4366604509179,\"storage\":0}},{\"dt\":\"2025-01-01 20:00:00\",\"value\":{\"coal\":0.45798956167779514,\"gas\":0.16392007028841246,\"biomass\":0.11194464998131488,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":250.65566873649408,\"storage\":0}},{\"dt\":\"2025-01-01 21:00:00\",\"value\":{\"coal\":0.4599074597563031,\"gas\":0.1650248472462731,\"biomass\":0.11339324889179779,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":229.40205973240762,\"storage\":0}},{\"dt\":\"2025-01-01 22:00:00\",\"value\":{\"coal\":0.4613589129046265,\"gas\":0.1659233612975514,\"biomass\":0.11451539494601566,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":208.35438635208362,\"storage\":0}},{\"dt\":\"2025-01-01 23:00:00\",\"value\":{\"coal\":0.46420860297848704,\"gas\":0.16772229959391005,\"biomass\":0.11643037591575615,\"nuclear\":0,\"pv\":0,\"wind\":0,\"solar_thermal\":0,\"solar_thermal_soc\":186.90901224770155,\"storage\":0}}]";
        System.out.println(jsonStr);
    }
}
